<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>历史涨停</title>
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<meta name="keywords" content="历史涨停" />
<meta name="description" content="历史涨停" />
<meta name="author" content="通达信短线犀利版单机插件" />
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="css/fhcms.mpwhf.css" type="text/css" rel="stylesheet" />
<link href="css/fhcms.extend.css" type="text/css" rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/vue.js"></script>
<script src="js/kzz.js"></script>
<script src="js/ztls.js"></script>
<script src="js/hygn.js"></script>
<script src="js/xiniuge.my.js"></script>
<link href="css/tdx.css?tdx=22" type="text/css" rel="stylesheet" />
<link href="css/dark.css?tdx=22" type="text/css" rel="stylesheet" />
<link href="css/dataTables.bootstrap4.min.css" type="text/css" rel="stylesheet" />
<link href="js/theme/default/laydate.css" type="text/css" rel="stylesheet" />
<script src="js/laydate.js"></script>
<style>
table.dataTable.table-sm .sorting:before, table.dataTable.table-sm .sorting_asc:before, table.dataTable.table-sm .sorting_desc:before{
	top:1px;
}
table.dataTable.table-sm .sorting:after, table.dataTable.table-sm .sorting_asc:after, table.dataTable.table-sm .sorting_desc:after{
	top:1px;
}
table thead th.sort-lr::before{
	left:5em !important;	
}
table thead th.sort-lr::after{
	left:5.3em !important;		
}
</style>
</head>

<body><script>skin();</script>
<nav class="border-bottom px-1 overflow-hidden h_25"></nav>
<script>navStr('lszt');</script>
<table id="datatable" class="table table-sm table-striped table-bordered nowrap dataTable no-footer mb-0 order-column" v-cloak>
	<thead>
    <tr>
        <th class="text-center w_20"><a href="javascript:window.location.reload()" class='orange'>刷</a></th>
        <th data-field="dm" data-sort-key="code" class="text-left w_45 d-none d-sm-table-cell dm sorting" data-way='asc'>代码</th>
        <th data-field="title" data-sort-key="prod_name" class="text-left w_50 mc sorting" data-way='asc' data-sortable="true">名称</th>
        <th data-field="p" data-sort-key="px_change_rate" class="text-center w_40 d-s-none sorting" data-way=''>涨%</th>
        <th data-field="c" data-sort-key="cur_price" class="text-center w_35 d-s-none sorting" data-way='asc'>价格</th>
		<th data-field="hs" data-sort-key="turnover_ratio" class="text-center d-none d-lg-table-cell w_20 sorting" data-way=''>换%</th>
		<th data-field="lt" data-sort-key="circulation_value" class="text-center d-none d-lg-table-cell w_20 sorting" data-way=''>流通</th>        
		<th data-field="z_lbs" data-sort-key="m_days_n_boards" class="text-center w_20 sorting" data-way=''>连</th>
		<th data-field="z_kbs" data-sort-key="plates" class="text-center w_20 sorting" data-way=''>板块</th>
		<th data-field="z_key" data-sort-key="time_on_market" class="sort-lr w_80 sorting" data-way='asc'>时间</th>
        <th data-field="z_key" data-sort-key="report_title" class="sort-lr sorting" data-way='asc'>研报</th>	
		<th data-field="z_key" data-sort-key="description" class="sort-lr sorting" data-way='asc'>涨停原因</th>		
    </tr>
    </thead>
    <tbody>
        
    <tr v-for="(sk,index) in list" :key="index" :dm="sk.code|dm" :id="'dm'+sk.code|dm"
        :class="[{ 'hover': hoverIndex === index}, {'active': activeIndex === index }, 'lbg'+ sk.m_days_n_boards]"
        v-bind:dm="sk.code|dm"
        v-on:click="handleClick(index)"
        v-on:mouseover="handleMouseOver(index)"
        v-on:mouseleave="handleMouseLeave(index)">
        <td class="font-num2 text-center order"></td>
        <td class="cursor-default d-none d-sm-table-cell"><a class="dm font-num1"  :href="'http://www.treeid/code_'+sk.code | dm">{{ sk.code | dm}}</a></td>
        <td class="cursor-default" :data-dm="sk.code | dm"><a class="dm"  :href="'http://www.treeid/code_'+sk.code | dm">{{ sk.prod_name }}</a></td>
        <td class="text-right d-s-none font-num1" :class="sk.px_change_rate | zhangDie">{{ sk.px_change_rate | num102 }}</td>
        <td class="text-right d-s-none font-num1">{{ sk.cur_price | num2 }}</td>
		<td class="text-right d-none d-lg-table-cell font-money">{{ sk.turnover_ratio | num102}}</td>
		<td class="text-right d-none d-lg-table-cell font-money">{{ sk.circulation_value | numCN}}</td>
		<td class="text-center">{{ sk.m_days_n_boards }}</td>
		<td class="text-center font-num1">{{ sk.plates}}</td>
		<td class="text-center font-num1">{{ sk.time_on_market }}</td>
		<td class=""><div class="fz_12"><a :href="sk.report_url" v-if="sk.report_title">{{ sk.report_title}}</a></div></td>		
		<td class=""><div class="text-truncate fz_12" :rel="sk.description | moreInfo">{{ sk.description}}</div></td>		
        
        
    </tr>
  </tbody>
</table>


<script>
var ltype='yesterday_limit_up';
var dxb=false;
laydate.render({
	elem:'#date1',
	type:'datetime',
	trigger:'click',
	done:function(value,date,endDate){	
		debugger;
		vv.loadList(value);
	}
});
</script>
<script>
var vv = new Vue({
	el:'#datatable',
	data:{
		list:[],
		originList:[],
		activeIndex:-1,
		hoverIndex:-1
	},
	created:function(){},
	mounted:function(){	
			document.querySelector('#date1').value = this.parseTime(new Date(),'{y}-{m}-{d} {h}:{i}:{s}')
			let dp = document.querySelector('#date1').value;
			if(!dp)return;
			this.loadList(dp)
	},
	methods:{
		loadList(dp){			
			this.$forceUpdate();
			let refreshIntervalId;
			const refreshData=()=>{
				let self=this;
				self.originList=[];
				self.list=[];
				
				jQuery.getJSON('https://flash-api.xuangubao.cn/api/surge_stock/stocks',{date:self.parseTime(dp,'{y}{m}{d}'),normal:true,uplimit:true},function(c){
					
					if(c && c.data && c.data.items && c.data.items.length>0){
						(c.data.items || []).forEach(xx=>{
							let odata = {
								code:xx[0],//代码
								prod_name:xx[1],//名字
								cur_price:xx[2],//价格
								px_change_rate:xx[3],
								circulation_value:xx[4],
								description:xx[5],
								enter_time:xx[6],
								up_limit:xx[7],
								plates:(xx[8] || []).flatMap(tt=>tt.name).join('+'),
								time_on_market:xx[9]?self.parseTime(xx[9],'{y}-{m}-{d} {h}:{i}'):'',
								turnover_ratio:xx[10],
								m_days_n_boards:xx[11],
								report_id:xx[12],
								report_title:xx[13],
								report_type:xx[14],
								report_url:xx[15]
							};
							self.originList.push(odata);
						})
					}
					(self.originList || []).forEach(xx=>{
						self.list.push(xx);
					});
					//self.originList.sort(function(a,b){
					//	return b.first_limit_up-a.first_limit_up
					//})
				});
				let rebind_reason = function(){
					self.$nextTick(()=>{					
						jQuery('.text-truncate').each(function(e,i){
							jQuery(this).html(jQuery(this).attr('rel'))
						})					
					})
				}
				rebind_reason();
				jQuery('#datatable th').click(function(){
					if(self.originList.length<1)
						return;
					let key = jQuery(this).attr('data-sort-key');
					if(jQuery(this).hasClass('sorting')){
						jQuery(this).removeClass('sorting');
						jQuery(this).addClass('sorting_desc');
						jQuery(this).addClass('active');
						let sbs = jQuery(this).siblings();
						sbs.removeClass('active');	
						sbs.removeClass('sorting_desc');							
						sbs.removeClass('sorting_asc');	
						for(let cc = 0;cc < sbs.length; cc++) {
							if(jQuery(sbs[cc]).attr('data-sort-key')){
								jQuery(sbs[cc]).addClass('sorting');
							}
						}
						 self.list.sort(function(a,b){
							if(typeof(a[key])=='string' && isNaN(a[key]))
								return b[key].localeCompare(a[key])								
							else
								return b[key]-a[key];
						})							
					}else if(jQuery(this).hasClass('sorting_desc')){
						jQuery(this).removeClass('sorting_desc');
						jQuery(this).addClass('sorting_asc');
						jQuery(this).addClass('active');
						let sbs = jQuery(this).siblings();
						sbs.removeClass('active');
						sbs.removeClass('sorting_desc');
						sbs.removeClass('sorting_asc');	
						for(let cc = 0;cc < sbs.length; cc++) {
							if(jQuery(sbs[cc]).attr('data-sort-key')){
								jQuery(sbs[cc]).addClass('sorting');
							}
						}
						self.list.sort(function(a,b){
							if(typeof(a[key])=='string' && isNaN(a[key]))									
								return a[key].localeCompare(b[key])
							else
								return a[key]-b[key];
						})							
					}else if(jQuery(this).hasClass('sorting_asc')){
						jQuery(this).removeClass('sorting_asc');
						jQuery(this).addClass('sorting');
						jQuery(this).removeClass('active');
						self.list=[];
						(self.originList || []).forEach(xx=>{
							self.list.push(xx);
						});
					}
					rebind_reason();
				});
				
			};
			refreshData();
		},
		parseTime(time, cFormat) {
			  if (arguments.length === 0) {
				return null
			  }
			  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
			  let date
			  if (typeof time === 'object') {
				date = time
			  } else {
				if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
				  time = parseInt(time)
				}
				if ((typeof time === 'number') && (time.toString().length === 10)) {
				  time = time * 1000
				}
				date = new Date(time)
			  }
			  const formatObj = {
				y: date.getFullYear(),
				m: date.getMonth() + 1,
				d: date.getDate(),
				h: date.getHours(),
				i: date.getMinutes(),
				s: date.getSeconds(),
				a: date.getDay()
			  }
			  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
				let value = formatObj[key]
				// Note: getDay() returns 0 on Sunday
				if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
				if (result.length > 0 && value < 10) {
				  value = '0' + value
				}
				return value || 0
			  })
			  return time_str
		},
		moreInfo(s){
			if(s && typeof(s.related_plates)!=='undefined'&&s.related_plates!==null){
				str='';
				for(var i=0;i<s.related_plates.length;i++){
					if(i>0)str+="+";
					str+=s.related_plates[i].plate_name
				}				
				str+=s.stock_reason;
				return str
			}
			else return false
		},
		loadKaiPanJia(){
			let self = this;
			let arr_codes = (self.originList || []).flatMap(ff=>{
				let cc = ff.symbol.split('.');
				return (cc[1].toLowerCase()+cc[0]).replace(/ss/gi,'sh');
			});
			let codes = arr_codes.join(',');
			let settings = {
			  "url": "http://sqt.gtimg.cn/q="+codes+"&offset=5,6,10,11,20,21",
			  "method": "GET",
			  "timeout": 0,
			};
			
			$.ajax(settings).done(function (response) {	
				if(response){
					let arr_rows = response.split('\n');
					if(arr_rows.length<1){
						return;
					}
					for(let tt=0;tt<arr_rows.length;tt++){
						if(!arr_rows[tt] || arr_rows[tt].length<1){
							continue;
						}
						let ff = arr_rows[tt].split('=');
						let req_code = ff[0].replace('v_','');
						let price =  ff[1].replace(/\"/gi,'').replace(/;/gi,'').split('~');
						let sa = (((price[1]-price[0])/price[0])*100);
						let ss = sa.toFixed(2)+'%';
						//$('td[data-id='+req_code+']').text(ss);
						
						for(let ii=0;ii<self.originList.length;ii++){
							if((self.originList[ii].symbol||'').match(/\d{6}/gi)[0]==req_code.match(/\d{6}/gi)[0]){								
								self.originList[ii].kaipanjia = sa;
								self.originList[ii].kaipanjia_percent = ss;
								if(price[4] ==0 && price[5]==0){//卖一价，卖一多少手，0标识涨停
									self.originList[ii].fengdan_e_du = (price[2]*price[3])*100;
								}else if(price[2] ==0 && price[3]==0){//买一价，买一多少手，0标识跌停
									self.originList[ii].fengdan_e_du = (price[4]*price[5])*100;
								}else{
									self.originList[ii].fengdan_e_du = 0;
								}
								break;
							}	
						}
					}
				}
				
			}).done(function(){
					(self.originList || []).forEach(xx=>{
						self.list.push(xx);
					});
			});
		},
		handleMouseOver(index){
			this.hoverIndex=index
		},
		handleMouseLeave(index){
			this.hoverIndex=-1
		},
		handleClick(index,event){
			this.activeIndex=index;
			//window.location.href='http://www.treeid/code_'+$('tbody tr:eq('+index+')').attr('dm')
		},
	}
});
</script>
<footer><div class="pb-1 px_5 text-info" id="info"></div>
</footer>
<script>infoHTML();footHTML();infoBtn();</script>


<div class="d-none">
<!--<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?545130ea2c3689fdce8723d75125d67b";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();

</script>-->
</div>

</body>
</html>
</div>

</body>
</html>